package com.cloud.xtools.user.domain.request.admin;

import com.cloud.xtools.common.validator.annotation.EntityExist;
import com.cloud.xtools.common.validator.annotation.FieldUnique;
import com.cloud.xtools.user.domain.entity.Permission;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class PermissionCreateRequest {
    @EntityExist(entity = Permission.class, message = "父级权限不存在")
    private Long parentId;
    @NotBlank
    private String name;
    @NotBlank
    @FieldUnique(entity = Permission.class, field = "identity", message = "权限标识已存在")
    private String identity;
    private String pageRoute;
    private Integer sort;
    private boolean menu;
    private final LocalDateTime createdAt = LocalDateTime.now();
    private final LocalDateTime updatedAt = LocalDateTime.now();
}
